/**
 *  EKology - An Ecosystem Simulation Framework
 *  Copyright (C) 2008  Aarón Tavío - aaron.tavio at gmail.com - ULPGC
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

package net.ekology.ekosystem.datatypes;

import net.ekology.core.datatypes.Attribute;
import java.util.Hashtable;
import java.io.Serializable;


/**
 * @author Aarón Tavío - aaron.tavio at gmail.com
 * @version 1.0.0 - 20081019-1700
 */
public class EKEvent implements Serializable {
    private String sName;
    private String sSourceID;
    private String sTargetID;
    private Hashtable<String,Attribute> htArgument;
    

    
    public EKEvent() {
        this.sName = null;
        this.sSourceID = null;
        this.sTargetID = null;
        this.htArgument = new Hashtable<String,Attribute>();
    }
    
    
    public EKEvent(String sName, String sSourceID, String sTargetID, Hashtable<String,Attribute> htArgument) {
        this.sName = sName;
        this.sSourceID = sSourceID;
        this.sTargetID = sTargetID;
        this.htArgument = htArgument;
    }
    
    
    public String getName() {
        return this.sName;
    }
    
    
    public void setName(String sName) {
        if (this.sName == null) this.sName = sName;
    }
    
    
    public String getSource() {
        return this.sSourceID;
    }
    
    
    public void setSource(String sSourceID) {
        if (this.sSourceID == null) this.sSourceID = sSourceID;
    }
    
    
    public String getTarget() {
        return this.sTargetID;
    }
    
    
    public void setTarget(String sTargetID) {
        if (this.sTargetID == null) this.sTargetID = sTargetID;
    }
    
    
    public Hashtable<String,Attribute> getArguments() {
        return this.htArgument;
    }
    
    
    public void setArguments(Hashtable<String,Attribute> htArgument) {
        if (this.htArgument == null) this.htArgument = htArgument;
    }
    
    
    public Attribute getArgument(String sName) {
        Attribute oResult = null;
        
        if (htArgument != null) oResult = htArgument.get(sName);
        
        return oResult;
    }
    
    
    @Override
    public String toString() {
        return String.format("{sName: \"%s\", sSourceID: \"%s\", sTargetID: \"%s\", htArgument: \"%s\"}", sName, sSourceID, sTargetID, htArgument);
    }

} // public class Attribute {
